//
//  UIImage+Cool.h
//  HX2Car
//
//  Created by Mudmen on 16/7/20.
//  Copyright © 2016年 Hx2car_mac. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, ColorGradientType) {
    ColorGradientTypeTopToBottom = 0,//从上到小
    ColorGradientTypeLeftToRight = 1,//从左到右
    ColorGradientTypeUpleftToLowright = 2,//左上到右下
    ColorGradientTypeUprightToLowleft = 3,//右上到左下
};

@interface UIImage (Cool)

+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size;

+ (NSData *)compressImage:(UIImage *)image toMaxFileSize:(NSInteger)maxFileSize;

+ (void)compressedImageFiles:(UIImage *)image
                       Index:(NSInteger)index
                     imageKB:(CGFloat)fImageKBytes
                  imageBlock:(void(^)(NSData *imageData,NSInteger index))block;

- (UIImage *) imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size;

//  颜色转换为背景图片
+ (UIImage *)imageWithColor:(UIColor *)color;

- (UIImage *)tintImageWithColor:(UIColor *)tintColor;

//颜色替换
//+ (UIImage*) imageToTransparent:(UIImage*) image;

+ (UIImage *)imageWithView:(UIView *)view;

- (UIImage *)bhb_applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;

//UIImage裁剪
+ (UIImage *)cropImage:(UIImage *)image withCropSize:(CGSize)cropSize;
// 图片模糊处理
+ (UIImage *)coreBlurImage:(UIImage *)image withBlurNumber:(CGFloat)blur;

#pragma mark - 渐变颜色
+ (UIImage *) colorGradientColorImageFromColors:(NSArray*)colors gradientType:(ColorGradientType)gradientType imgSize:(CGSize)imgSize;
+ (UIImage*)imageCompressWithSimple:(UIImage*)image;
@end
